﻿@{
    ViewBag.Title = "";
}
<!DOCTYPE html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title>药品统计</title>
    <link rel="stylesheet" type="text/css" href="~/Scripts/jquery-easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="~/Scripts/jquery-easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="~/Scripts/jquery-easyui/demo.css">
    <link rel="stylesheet" type="text/css" href="~/Scripts/uploader/uploadify.css" />
    <script type="text/javascript" src="~/Scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery-easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="~/Scripts/uploader/jquery.uploadify.min.js"></script>
    <script type="text/javascript" src="~/Scripts/uploader/swfobject.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
    <script type="text/javascript" src="~/Scripts/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="~/Scripts/MicrosoftMvcAjax.js"></script>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/themes/default/easyui.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/themes/icon.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/demo.css")'/>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/uploader/uploadify.css")' />
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-1.8.2.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-easyui/jquery.easyui.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-easyui/locale/easyui-lang-zh_CN.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/uploader/jquery.uploadify.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/uploader/swfobject.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/MicrosoftAjax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/MicrosoftMvcAjax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js")'></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#dgtable').datagrid({
                url: "/Drug/GetDrugReportList",
                pagination: true,//分页控件  
                singleSelect: true,//是否单选
                rownumbers: true,
                queryParams: { '_pageNumber': 1, '_cId': -1, '_risklevel':'', '_sDate': '', '_eDate': '' },
                columns: [[
                    { field: 'AreaName', title: '使用单位', width: 180 },
                    { field: 'drugCode', title: '编号', width: 150 },
                    { field: 'drugName', title: '名称', width: 180 },
                    { field: 'unit', title: '单位', width: 50 },
                    { field: 'amountIN', title: '入库', width: 50 },
                    { field: 'amountOUT', title: '出库', width: 50 },
                    { field: 'amount', title: '使用数量', width: 80 },
                    { field: 'riskLevel', title: '危险性分类', width: 80 },
                    { field: 'remark', title: '备注', width: 200 }
                ]]
            });
            var p = $('#dgtable').datagrid('getPager');
            $(p).pagination({
                pageSize: 10,//每页显示的记录条数，默认为10  
                pageList: [8],//可以设置每页记录条数的列表  
                onSelectPage: function (pageNumber, pageSize) {
                    var tablequeryParams = $('#dgtable').datagrid('options').queryParams;
                    tablequeryParams._pageNumber = pageNumber;
                    tablequeryParams._cId = $('#ddl_cid').val();
                    tablequeryParams._rId = $('#ddl_rid').val();
                    tablequeryParams._sDate = $('#txtsDate').val();
                    tablequeryParams._eDate = $('#txteDate').val();
                    $('#dgtable').datagrid('options').queryParams = tablequeryParams;
                    $("#dgtable").datagrid("reload");
                }
            });
            $('#txtsDate').click(function () { WdatePicker({ maxDate: '#F{$dp.$D(\'txteDate\',{d:-1});}' }) });
            $('#txteDate').click(function () { WdatePicker({ minDate: '#F{$dp.$D(\'txtsDate\',{d:1});}' }) });
        });

        function click_Search() {
            if ($('#txtsDate').val() == null || $('#txtsDate').val() == "" || $('#txteDate').val() == null || $('#txteDate').val() == "") {
                alert("请选择一个完整的时间区间！");
                return;
            }
            var tablequeryParams = $('#dgtable').datagrid('options').queryParams;
            tablequeryParams._cId = $('#ddl_cid').val();
            tablequeryParams._risklevel = $("#ddl_rid").find("option:selected").text();
            
            tablequeryParams._sDate = $('#txtsDate').val();
            tablequeryParams._eDate = $('#txteDate').val();
            $('#dgtable').datagrid('options').queryParams = tablequeryParams;
            $("#dgtable").datagrid("reload");
        }
    </script>
    <style type="text/css">
        .divList {
            position: absolute;
            top: 1px;
            left: 1px;
            z-index: 99;
            width: 1048px;
        }

        a {
            text-decoration: none;
            color: #000;
        }

            a img {
                border: 0;
            }

        .biaoge {
            width: 1040px;
            font-family: '宋体';
            font-size: 12px;
            color: #10607c;
        }

            .biaoge td {
                text-align: center;
                height: 26px;
                vertical-align: middle;
                border: 1px solid #d4d3d3;
            }
    </style>
</head>
<body style="background-color: transparent; overflow: hidden;">
    <table cellpadding="0" cellspacing="0" width="1040px">
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" width="1040px">
                    <tr>
                        <td style="font-family: '宋体'; font-size: 12px; color: #10607c;">单位名称：      
                            @if ((Session["UserInfo"] as Model.PersonnelManage.E_tb_InPersonnel).DataRange == 1)
                            {
                                @Html.DropDownList("ddl_company", ViewData["ddl_company"] as SelectList, new { @id = "ddl_cid" })
                            }
                            else
                            { 
                                @Html.DropDownList("ddl_company", ViewData["ddl_company"] as SelectList, new { @id = "ddl_cid", @disabled = "disabled" })
                            }
                        </td>
                        <td style="font-family: '宋体'; font-size: 12px; color: #10607c;">危险性分类：      
                                @Html.DropDownList("ddlrisklevel", ViewData["ddl_risklevel"] as SelectList, new { @id = "ddl_rid" })
                        </td>
                        <td style="font-family: '宋体'; font-size: 12px; color: #10607c;">日期：      
                                    <input type="text" id="txtsDate" width="80"/>至：      
                                    <input type="text" id="txteDate"  width="80" />
                        </td>
                        <td>
                            <a href="javascript:void(0)" onclick="click_Search()">
                                <img src='@Url.Content("~/Content/Images/统计.png")' /></a>
                        </td>
                        <td align="right">
                            <a href="javascript:void(0)">
                                <img src='@Url.Content("~/Content/Images/导出Excel.png")' /></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table cellpadding="0" cellspacing="0" class="biaoge" id="dgtable" height="400px">
                </table>
            </td>
        </tr>
    </table>
</body>
